<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/bpmapp.tld" prefix="ssp" %>
<%@ page import="java.util.Locale" %>
<%@ page import="org.apache.struts.Globals" %>
<%@ page import="java.io.InputStream" %>
<%@ page import="java.util.ResourceBundle" %>
<%@ page import="java.util.Enumeration" %>
<%@ page import="com.broadvision.bpmapp.taglib.QuerySspTag.SSPDetail" %>

<%!
	public boolean contains(ResourceBundle bundle, String value) {
		Enumeration enumeration = bundle.getKeys();
		while (enumeration.hasMoreElements()) {
			String key = (String)enumeration.nextElement();
			if (bundle.getString(key).trim().equals(value))
				return true;
		}
		return false;
	}
%>

<% String ctPath = request.getContextPath(); %>

<%
	Locale locale = (Locale) request.getSession().getAttribute(Globals.LOCALE_KEY);
  	if (locale == null) {
    		locale = Locale.getDefault();
  	}

	ResourceBundle bundle = null;
	try {
		bundle = ResourceBundle.getBundle("com.broadvision.bpmapp.sample.action.HiddenProcesses",
							   locale, this.getClass().getClassLoader());
	}
	catch (Exception e) {
		//we will never get here.
		e.printStackTrace();
	}

%>

<div class="block">
  <div class="menuBlocktitle">
    <span><bean:message bundle="appCommonRes" key="bp.processes" /></span>
  </div>
  <ssp:querySsp id="processes" hostPage="/loginPage.do" exitURL="/loginPage.do" />
  <div class="menuBlockWrap">
	  <logic:iterate id="processItem" name="processes" >

     <% if (contains(bundle, ((SSPDetail)processItem).getProcessName()) == false &&
	      contains(bundle, ((SSPDetail)processItem).getPackageName()) == false) { %>
      <div class="browseCat">
        <a href = "<bean:write name="processItem" property="launchURL" />">
				  <img src="<%= ctPath %>/ga/images/buttons/gbtn_channel.gif" width="15" height="15" align="left" border="0" alt="List Icon" title="List Icon">
          <bean:write name="processItem" property = "processName" />
        </a>
		  </div>
		<% } %>

    </logic:iterate>
  </div>
</div>
